﻿
Imports LibMultiPlug.Core.Plugins

Module Start

    Sub Main()

        Dim sm As LibMedienverwaltung.Services.ServiceManager = _
            LibMedienverwaltung.Services.ServiceManager.GetInstance()
        
        Dim ads As LibMedienverwaltung.Services.AmazonDataService = _
        	sm.GetAmazonDataService()
        
        Dim itemSearchRequest As New LibMedienverwaltung.Amazon.ItemSearchRequest
        
        Dim itemSearch As LibMedienverwaltung.Amazon.ItemSearch
        Dim lom As New List(Of LibMedienverwaltung.Medien.Medium)
        
        itemSearchRequest.SearchIndex = "All"
        itemSearchRequest.Keywords = "iron man".Replace(" ", "+")
        itemSearchRequest.ResponseGroup = New String() {"Large", "Collections"}
        itemSearchrequest.ItemPage = "1"
        
        itemSearch = New LibMedienverwaltung.Amazon.ItemSearch
        itemSearch.Request = New LibMedienverwaltung.Amazon.ItemSearchRequest() {itemSearchRequest}
        itemSearch.AWSAccessKeyId = ads.AccessKeyId
        
        Dim searchResponse As LibMedienverwaltung.Amazon.ItemSearchResponse = _
        	ads.RequestWait(itemSearch)
        
        If searchResponse.Items.Length > 0 Then
        	
        	For Each item As LibMedienverwaltung.Amazon.Item in searchResponse.Items(0).Item
        		lom.Add(LibMedienverwaltung.Medien.Medium.FromAmazonItem(item))
        	Next
        	
        End If
        
        Console.WriteLine("Press any key to exit...")
        Console.ReadKey(True)
        
    End Sub

End Module
